//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.smartstate.EnvironmentMonitor.exception;


import com.smartstate.EnvironmentMonitor.constant.BaseErrorEnum;
import com.smartstate.EnvironmentMonitor.vo.BaseResultCode;
import com.smartstate.EnvironmentMonitor.vo.ResultCode;

import java.util.Arrays;

public class CommonException extends RuntimeException {
    public Integer code;
    public String msg;
    public Object[] args;

    public CommonException() {
        super(ResultCode.COMMON_FAIL.getMessage());
        this.code = ResultCode.COMMON_FAIL.getCode();
        this.msg = ResultCode.COMMON_FAIL.getMessage();
    }

    public CommonException(String msg) {
        super(msg);
        this.msg = msg;
        this.code = ResultCode.COMMON_FAIL.getCode();
    }

    public CommonException(String msg, Integer code) {
        super(msg);
        this.msg = msg;
        this.code = code;
    }

    public CommonException(String msg, Integer code, Object... args) {
        super(msg);
        this.msg = msg;
        this.code = code;
        if (args != null && args.length > 0) {
            this.args = args;
        }

    }

    public CommonException(String msg, BaseErrorEnum code) {
        super(msg);
        this.msg = msg;
        this.code = code.getCode();
    }

    public CommonException(String msg, BaseErrorEnum code, Object... args) {
        super(msg);
        this.msg = msg;
        this.code = code.getCode();
        if (args != null && args.length > 0) {
            this.args = args;
        }

    }

    public CommonException(BaseResultCode status) {
        super(status.getMessage());
        this.code = status.getCode();
        this.msg = status.getMessage();
    }

    public Integer getCode() {
        return this.code;
    }

    public String getMsg() {
        return this.msg;
    }

    public Object[] getArgs() {
        return this.args;
    }

    public void setCode(final Integer code) {
        this.code = code;
    }

    public void setMsg(final String msg) {
        this.msg = msg;
    }

    public void setArgs(final Object[] args) {
        this.args = args;
    }

    public boolean equals(final Object o) {
        if (o == this) {
            return true;
        } else if (!(o instanceof CommonException)) {
            return false;
        } else {
            CommonException other = (CommonException)o;
            if (!other.canEqual(this)) {
                return false;
            } else {
                label39: {
                    Object this$code = this.getCode();
                    Object other$code = other.getCode();
                    if (this$code == null) {
                        if (other$code == null) {
                            break label39;
                        }
                    } else if (this$code.equals(other$code)) {
                        break label39;
                    }

                    return false;
                }

                Object this$msg = this.getMsg();
                Object other$msg = other.getMsg();
                if (this$msg == null) {
                    if (other$msg != null) {
                        return false;
                    }
                } else if (!this$msg.equals(other$msg)) {
                    return false;
                }

                if (!Arrays.deepEquals(this.getArgs(), other.getArgs())) {
                    return false;
                } else {
                    return true;
                }
            }
        }
    }

    protected boolean canEqual(final Object other) {
        return other instanceof CommonException;
    }

    public int hashCode() {
//        int PRIME = true;
        int result = 1;
        Object $code = this.getCode();
        result = result * 59 + ($code == null ? 43 : $code.hashCode());
        Object $msg = this.getMsg();
        result = result * 59 + ($msg == null ? 43 : $msg.hashCode());
        result = result * 59 + Arrays.deepHashCode(this.getArgs());
        return result;
    }

    public String toString() {
        Integer var10000 = this.getCode();
        return "CommonException(code=" + var10000 + ", msg=" + this.getMsg() + ", args=" + Arrays.deepToString(this.getArgs()) + ")";
    }
}
